package com.my.learn.design.singleton;

/**
 * 懒汉模式
 */
public class Singleton02 {

    private static volatile Singleton02 singleton02;

    private Singleton02() {

    }

    public Singleton02 getInstance() {
        if (singleton02 == null) {
            synchronized (Singleton02.class) {
                if (singleton02 == null) {
                    singleton02 = new Singleton02();
                }
            }
        }
        return singleton02;
    }

}
